package com.wise.mall.portal.controller.ums;

import com.wise.mall.common.domain.response.UserDto;
import com.wise.mall.common.model.Result;
import com.wise.mall.portal.service.ums.MemberService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * 会员登录注册管理Controller
 *
 * @author shiweinan
 * @date 2018/8/3
 */
@RestController
@Api(tags = "UmsMemberController", value = "会员登录注册管理")
@RequestMapping("/sso")
public class MemberController {

    @Autowired
    private MemberService memberService;


//    @ApiOperation("会员登录")
//    @RequestMapping(value = "/login", method = RequestMethod.POST)
//    @ResponseBody
//    public Result login(@RequestParam String username,
//                        @RequestParam String password) {
//        return memberService.login(username, password);
//    }

    @ApiOperation("根据用户名获取通用用户信息")
    @RequestMapping(value = "/loadByUsername", method = RequestMethod.GET)
    @ResponseBody
    public Result<UserDto> loadUserByUsername(@RequestParam String username) {
        return Result.success(memberService.loadUserByUsername(username));
    }
}
